#include<stdio.h>
#include<string.h>
#include"global.h"
modify(){
	char named[20],key='\0';
	CI *p1;
	p1=head;
	p1=head;
	if (p1==NULL ){
		printf("delete.c : LinkList is empty that can not modify\n");
		return(0);
	}
	printf("\nfind the name of the one you need to modify\n");
	find();
	printf("\nenter the exact name you need to modify\n");
	scanf("%[^\n]",named);getchar();
	while (strcmp(p1->name,named)!=0&&p1->next!=NULL)
		p1 = p1->next;
	if(strcmp(p1->name,named)==0){
		printf("\n%s\t%s\t%c\t%d\t%s\n",p1->name,p1->telphone,p1->sex,p1->age,p1->phone);
	while(key!='M'&&key!='G'){
		printf("\nM  :Modify\nG  :Give up\n");
		key=getchar();
		if(key=='M'){
				printf("enter the name of contact:");
				scanf("%s",p1->name);
				getchar();
				printf("enter the telphone of %s contact:",p1->name);
				scanf("%s",p1->telphone);
				getchar();
				printf("enter the age of %s contact:",p1->name);
				scanf("%d",&p1->age);
				getchar();
				printf("enter the sex of %s contact:",p1->name);
				scanf("%c",&p1->sex);
				getchar();
				printf("enter the family phone of %s contact:",p1->name);
				scanf("%s",p1->phone);
				getchar();
				filewritefor(head);
			}
			else if(key=='G')
				return(0);
			else
				printf("\nNo such selection!\n");
		}
	}
	else
		printf("\nCannot find !\n");
}


